function [out,error]=quant(f,B)% [out,error] = quant(f,B)  QUANT rounds f to a B bit (1 sign bit, % B-1 fraction bits) signed fractional fixed point binary number.  OUT is% quantized number in base 10 and ERROR is the quatization error.%% INPUTS:%   f = floating point fractional to quantize	 %   B = number of binary bits  (1 sign bit, B-1 fraction bits)% OUTPUTS:%   out   = floating point number equal to quantized B-bit %           signed fractional binary number (1 sign bit, B-1 fraction bits)%   error = error due to quantization%N = 2^(B-1);out   = (round(f .* N)) ./ N;error = f-out;return	  